//函数组合的好吃 避免了洋葱代码 一层又一层的  
const _=require('lodash')
function compose(f,n){
    return function(value){
        return f(n(value))
    }
}

function reverse(array){
    return array.reverse()
}

function frist(array){
    return array[0]
}
let fns=compose(frist,reverse)
console.log(fns([1,2,3]))

const reveres= item => item.reverse()
const first=item =>item[0]
const toUpper= item=>item.toUpperCase()
let last=_.flowRight(toUpper,first,reveres)
console.log(last(['one','two','three']))